﻿// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.X509Logo
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 8E14765A-6610-409A-BA36-099A0642905D
// Assembly location: E:\git\ALLIDA\windll\infocard.exe

using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;

namespace Microsoft.InfoCards
{
  internal abstract class X509Logo
  {
    private X509LogoType m_logoType;
    private string m_mediaType;
    private Dictionary<Oid, byte[]> m_fileHashes;
    private List<string> m_fileLocations;

    public X509LogoType LogoType
    {
      get
      {
        return this.m_logoType;
      }
    }

    public string MediaType
    {
      get
      {
        return this.m_mediaType;
      }
    }

    public Dictionary<Oid, byte[]> Hashes
    {
      get
      {
        return this.m_fileHashes;
      }
    }

    public List<string> FileLocations
    {
      get
      {
        return this.m_fileLocations;
      }
    }

    public X509Logo(
      X509LogoType logoType,
      string mediaType,
      Dictionary<Oid, byte[]> hashes,
      List<string> fileLocations)
    {
      this.m_logoType = logoType;
      this.m_mediaType = mediaType;
      this.m_fileHashes = hashes;
      this.m_fileLocations = fileLocations;
    }

    public override string ToString()
    {
      return base.ToString();
    }

    protected virtual void OnSerialize(BinaryWriter writer)
    {
    }

    public void Serialize(BinaryWriter writer)
    {
      writer.Write((byte) this.LogoType);
      Utility.SerializeString(writer, this.MediaType);
      writer.Write(this.Hashes.Count);
      foreach (Oid key in this.Hashes.Keys)
      {
        Utility.SerializeString(writer, key.Value);
        Utility.SerializeBytes(writer, this.m_fileHashes[key]);
      }
      writer.Write(this.FileLocations.Count);
      foreach (string fileLocation in this.FileLocations)
        Utility.SerializeString(writer, fileLocation);
      this.OnSerialize(writer);
    }
  }
}
